home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / TPWENG / PUTDATE.PAS < prev    next >
Pascal/Delphi Source File  |  1991-07-22  |  887b  |  37 lines

  1. program PutDate;
  2. uses PXEngine, WinCrt;
  3.  
  4. const TableName = 'Table';
  5.  
  6. var   PxErr: Integer;
  7.       TblHandle: TableHandle;
  8.       RecHandle: RecordHandle;
  9.       FldHandle: FieldHandle;
  10.       Month, Day, Year: Integer;
  11.       Date: Longint;
  12.  
  13. procedure PX(Code : integer);
  14. begin
  15.   writeln(PXErrMsg(Code));
  16. end;
  17.  
  18. begin
  19.   PX(PXWinInit('MyApp', pxShared));
  20.   Month := 1; Day := 27; Year := 1990;
  21.  
  22.   PX(PXTblOpen(TableName, TblHandle, 0, False));
  23.   PX(PXRecBufOpen(TblHandle, RecHandle));
  24.   PX(PXFldHandle(TblHandle, 'Date Field', FldHandle));
  25.   PX(PXDateEncode(Month, Day, Year, Date));
  26.  
  27.   (* Update record with new date *)
  28.   PxErr := PXPutDate(RecHandle, FldHandle, date);
  29.   if PxErr <> PxSuccess then
  30.     Writeln(PxErrMsg(PxErr))
  31.   else PX(PXRecUpdate(TblHandle, RecHandle));
  32.  
  33.   PX(PXRecBufClose(RecHandle));
  34.   PX(PXTblClose(TblHandle));
  35.   PX(PXExit);
  36. end.
  37.